import codecs
import sys

org_path = sys.argv[1]
re_path = sys.argv[1] + '.partinput'

orgs = codecs.open(org_path, 'r', encoding='utf8').readlines()

res = []
for o in orgs:
    segs = o.strip().split(' <SEP> ')
    prp = segs[0]
    abs = segs[1]
    words = abs.split(' ')
    abs = ' '.join(words[:int(len(words)/2)])
    r = ' '.join([prp, '<SEP>', abs, '\n'])
    res.append(r)

re_file = codecs.open(re_path, 'w', encoding='utf8')
re_file.write(''.join(res))

